<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <script type="text/javascript">
            function showDetail(rowKey){
                selectedRowDetail(rowKey);
            }
        </script>
        <style type="text/css">
            .active-row{
                background-color: #FFEBDA !important;
                cursor: pointer;
            }
        </style>
    </h:head>
    <h:body>
        <h:form>
            <rich:panel header="部门-支出类别-项目统计表" styleClass="content-hight">
                <h:panelGrid columns="6" style=" text-align: left" >
                    <h:outputLabel value="年度:"/>
                    <h:selectOneMenu value="#{executTotalGovBean.iyear}">
                        <f:selectItem itemValue="" itemLabel="--请选择年度--"/>
                        <f:selectItems value="#{executTotalGovBean.yearli}"/>
                        <a4j:ajax event="change" render="qbutton"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="计划状态："/>
                    <h:selectOneMenu value="#{executTotalGovBean.status}" >
                        <f:selectItem itemValue="" itemLabel="--请选择计划状态--"/>
                        <f:selectItems value="#{executTotalGovBean.selectItemList}"/>
                        <a4j:ajax event="change" render="qbutton"/>
                    </h:selectOneMenu>
                    <a4j:commandButton id="qbutton" value="查询" action="#{executTotalGovBean.query}"
                                       render="dataTabelArea,ebutton"
                                       onclick="this.disabled='true'"
                                       disabled="#{empty executTotalGovBean.iyear}"/>
                    <h:commandButton id="ebutton" value="导出Excel" action="#{executTotalGovBean.exportExcel}"
                                     disabled="#{executTotalGovBean.statListModel.rowCount le 0}"/>
                </h:panelGrid>
                 <h:panelGrid  style=" text-align: left" >
                <h:panelGroup id="dataTabelArea">
                    <rich:dataScroller for="editTable" execute="@this" render="dataTabelArea"/>
                    <div style="-moz-user-select:none;width:750px;height: 350px;overflow:auto">
                        <rich:dataTable id="editTable" value="#{executTotalGovBean.statListModel}" var="item" rowKeyVar="rowKey"
                                        rowClasses="list-row-odd,list-row-even" rows="15"
                                        headerClass="table-header"
                                        styleClass="tableStyle"
                                        style="width:100%;margin-bottom: 5px"
                                        noDataLabel="无数据!">
                            <rich:column>
                                <f:facet name="header">部门</f:facet>
                                <h:outputText value="#{item.deptName}" rendered="#{item.quality == ''}" />
                                <h:outputText value="合计" rendered="#{empty item.deptName}"/>
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">支出类别</f:facet>
                                <h:outputText value="基本支出" rendered="#{item.quality =='0'
                                                                            and item.projName == ''
                                                                            and item.cateName == ''}"/>
                                <h:outputText value="项目支出" rendered="#{item.quality =='1'
                                                                            and item.projName == ''
                                                                            and item.cateName == ''}"/>
                            </rich:column>
                            <rich:column style="text-align: center" >
                                <f:facet name="header">项目</f:facet>
                                <h:outputText value="#{item.projName}" rendered="#{item.cateName == ''}" />
                                <h:outputText value="--" rendered="#{item.projName == ''
                                                                       and item.quality != ''
                                                                       and item.quality =='0'
                                                                       and item.cateName != ''}" />
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">品目</f:facet>
                                <h:outputText value="#{item.cateName}"/>
                            </rich:column>
                            <rich:column style="text-align:right">
                                <f:facet name="header">数量</f:facet>
                                <h:outputText value="#{item.countTotal}"/>
                            </rich:column>
                             <rich:column style="text-align:right">
                                <f:facet name="header">单价</f:facet>
                                <h:outputText value="#{item.budget/item.countTotal}">
                                    <f:convertNumber type="double" pattern="###,##0.00"/>
                                </h:outputText>
                            </rich:column>
                            <rich:column style="text-align:right">
                                <f:facet name="header">金额</f:facet>
                                <h:outputText value="#{item.budget}">
                                    <f:convertNumber type="double" pattern="###,##0.00"/>
                                </h:outputText>
                            </rich:column>
                        </rich:dataTable>
                    </div>
                </h:panelGroup>
                 </h:panelGrid>
            </rich:panel>
        </h:form>
    </h:body>
</ui:composition>
